package db.tables;

import java.sql.SQLException;

import org.hsqldb.Types;

import db.DBObject;

public class DBGroupTable extends DBObject {
	
	public static final String TABLE_NAME="user_group";
	
	public static final String GROUP_ID_COL = TABLE_NAME+"_id",
			GROUP_NAME_COL = TABLE_NAME+"_name", 
			HOMEPAGE_COL = "homepage",
			TOWN_ID_COL = DBTownTable.TOWN_ID_COL,
			CATEGORY_ID_COL = DBCategoryTable.CATEGORY_ID_COL;

	public DBGroupTable() throws ClassNotFoundException, SQLException {
		super(TABLE_NAME, new Object[][] {
				{ GROUP_ID_COL, Types.BIGINT, SQL_IDENTITY_PRIMARY_KEY, "" },
				{ GROUP_NAME_COL, Types.VARCHAR, SQL_NOT_NULL, "" },
				{ HOMEPAGE_COL, Types.VARCHAR, "", "" },
				{ TOWN_ID_COL, Types.BIGINT, "", "" },
				{ CATEGORY_ID_COL, Types.BIGINT,
					getSQLForeignKeyReference(DBCategoryTable.TABLE_NAME, CATEGORY_ID_COL)
					+getSQLForeignKeyReference(DBTownTable.TABLE_NAME, TOWN_ID_COL),"" }});
	}
}
